import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const _import = require('./_import_' + process.env.NODE_ENV);

/**
 * 无需校验的路由数组
 * hidden: true                                   如果该值为true，将不会出现在左侧导航栏中
 *
 * @type {*[]}
 */
export const constantRouterMap = [
  {
    path: '',
    redirect: 'layout',
    component: _import('layout/index'),
    hidden: true,
    meta: {
      title: '首页',
      icon: ['fas', 'tachometer-alt'],
    },
    children: [
      {
        path: 'layout',
        name: 'layout',
        component: _import('article/hotList'),
        meta: {
          title: '首页',
          icon: ['fas', 'tachometer-alt'],
        },
      }
    ]
  },
  {
    path: '/article',
    redirect: 'articleDetail',
    component: _import('layout/index'),
    hidden: true,
    meta: {
      title: '文章',
      icon: ['fas', 'tachometer-alt'],
    },
    children: [
      {
        path: '/article/detail',
        name: 'articleDetail',
        component: _import('article/detail'),
        meta: {
          title: '文章详情',
        },
      }
    ]
  },
  {
    path: '/speak',
    redirect: 'speakIndex',
    component: _import('layout/index'),
    children: [
      {
        path: 'index',
        name: 'speakIndex',
        component: _import('speak/index'),
        meta: {
          title: '生活吐槽',
          icon: ['fab', 'accusoft']
        },
      }
    ]
  }
];

export default new Router({
  routes: constantRouterMap
})
